		
        <script type="text/javascript" src="<?php $this->path('js/selectBox.js');?>"></script>
		
		<section id="main" class="entire_width">
    		<div class="container_12">
			   <?php $this->getPageCrumb(); ?> 
        		<div id="content" class="grid_9" style="min-height:400px;float:left;width:90%;">
        			<h1 class="page_title">Configuration</h1>
					<form method="post" action="" onsubmit="return false" class="form_style registed">
						<strong>Admin Settings</strong>
						<table style="width: 71%;">
							<thead>
								<tr style="display:block;position:relative;">
									<th style="width: 200px;">Userid</th>
									<th style="width: 250px;">Name</th>
									<th style="width: 200px;">Edit Type</th>
								</tr>
							</thead>
							<tbody style="height: 250px;overflow: auto;display: block;width:100%;" id="list">
							</tbody>
						</table>
						<input style="float:right;" type="button" value="Create User"/>
						<input class="settings2" style="float:right;" type="button" value="Save"  disabled/>
						<div class="clear"></div>
					</form>
					<form method="post" action="" onsubmit="return false" class="form_style registed">
						<div class="clear"></div>
						<div style="float:left;width:65%">
    						<strong>System Settings</strong>
    						<br />
    						<br />
    						<!--Hostname :
    						<sup class="surely" style="font-size:x-small;">Your MySQL hostname. Usualy named as 'localhost', so you're NOT necessary to change this even this script has already online on the internet.</sup><br />
                            <input type="text" style="width:80%" value="localhost" /><br />
    						Database :
    						<sup class="surely" style="font-size:x-small;">Your database name.</sup><br />
    						<input type="text" style="width:80%" value="database"><br />
    						Username :
    						<sup class="surely" style="font-size:x-small;">Your database username.</sup><br />
                            <input type="text" style="width:80%" value="root" /><br />
    						Password :
    						<sup class="surely" style="font-size:x-small;">Your database password. If your database has no password, leave it empty.</sup>
                            <input type="password" style="width:80%" value="test" /><br />-->
    						Url : 
    						<sup class="surely" style="font-size:x-small;">Base url of the Web POS</sup><br />
                            <input class="settings_" type="text" style="width:80%" default="<?php echo $settings['base_url']; ?>" value="<?php echo $settings['base_url']; ?>" /><br />
    						Web POS Name :
    						<sup class="surely" style="font-size:x-small;">Name of the Web POS.</sup><br />
                            <input class="settings_" type="text" style="width:80%" default="<?php echo $settings['name']; ?>" value="<?php echo $settings['name']; ?>" /><br />
    						Time Zone :
    						<sup class="surely" style="font-size:x-small;">Your Systems Time Zone.</sup><br />
                            <input class="settings_" type="text" style="width:80%" default="<?php echo $settings['time_zone']; ?>" value="<?php echo $settings['time_zone']; ?>" /><br />
    						Session name
    						<!--<sup class="surely" style="font-size:x-small;">Session used for your WEB POS.</sup><br />
                            <input class="settings" type="text" style="width:80%" default="<?php echo $settings['session']; ?>" value="<?php echo $settings['session']; ?>" /><br />-->
						</div>
						<div style="float:right;width:35%">
							<input class="settings"  type="button" value="Save"  disabled/>
							<input class="settings"  type="button" value="Reset" disabled/>
						</div>
						<div class="clear"></div>
					</form>
        	    </div>	
			</div>
        	<div class="clear"></div>
		</section>
		<script>
		$(document).ready(function(){
			$('#branding #site_logo').parent().parent().css('margin-top','-40px').show();
			$('#branding #cart_nav').hide();
			$('#branding .grid_3 .search').hide();
			$('#branding .private ul').children().hide();
			$('#branding .private ul li:nth-child(5)').show();
			$('#block_nav_primary').css('background', '#f5f7f9');
			$('#branding .private ul li:nth-child(6)').show();
			$('#branding .private ul li:last-child').show().parent().parent().css({"margin-right": "-260px", "margin-top": "-5px"}).parent().css('height','10px');
			$('header#branding').css('height','50px');
			$('.phone_top').parent().css('visibility','hidden');
			$('#header-top').hide().parent().css('padding-top','10px');
			$('footer .f_navigation').hide();
			
			$.post('?module=configuration&ajax=1', {getu:1}, function (data) {
				var list = "";
				var li = eval(data);
				for(i=0; i<li.length; i++){
    				list += '<tr class="list ease select" aid="' + li[i]['aid'] + '">';
    				list += '	<td style="width: 200px;">' + li[i]['userid'] + '</td>';
    				list += '	<td style="width: 250px;">' + li[i]['first_name'] + '</td>';
    				list += '	<td style="width: 200px;">' + li[i]['type'] + '</td>';
    				list += '</tr>';
				}
				$('#list').hide().html(list).fadeIn();
				$('#list tr').each(function(){
					y = $(this).find('td:nth-child(3)');
					x = y.text();
					y.html('<select default="' + x + '"><option value="3">Not Assigned</option><option value="99">Admin</option><option value="4">Cashier</option><option value="5">Stock Manager</option></select>');
					y.find('select').selectBox().change(function(){
          				ischange = false;
          				$('#list').find('select').each(function(){
          					if($(this).attr('default') != $(this).val())
          						ischange = true;
          				});
          				if(ischange)
          					$('.settings2[type=button]').attr('disabled', false);
          				else
          					$('.settings2[type=button]').attr('disabled', true);
          			});
					va = y.find('select').find('option[value=' + x + ']').attr('selected', true).text();
					y.find('select').next().find('span:first-child').html(va);
				});
			});
			
			$('.settings_[type=text]').change(function(){
				ischange = false;
				$('.settings_[type=text]').each(function(){
					if($(this).attr('default') != $(this).val())
						ischange = true;
				});
				if(ischange)
					$('.settings[type=button]').attr('disabled', false);
				else
					$('.settings[type=button]').attr('disabled', true);
			});
			
			$('.settings2[type=button]').click(function(){
				if($(this).attr('disabled'))
					return;
				$('#list tr').each(function(){
					y = $(this).find('td:nth-child(3)');
					aid = y.find('select').parent().parent().attr('aid');
					def = y.find('select').attr('default');
					val = y.find('select').val();
					if(def != val){
						y.find('select').attr('default', val);
						$.post('?module=configuration&ajax=1',{changeset:1, aid:aid, val:val});
						$('#list').hide().fadeIn('slow');
						$(this).attr('disabled', true);
					}
				});
			});
			
			$('.settings[type=button]').click(function(){
				if($(this).val() == 'Reset'){
    				$('.settings[type=text]').each(function(){
    					$(this).val($(this).attr('default'));
    				});
				}else{
    				$('.settings_[type=text]').each(function(){
    					$(this).attr('default', $(this).val());
    				});
					base_url = $($('.settings_')[0]).val();
					time_zone = $($('.settings_')[1]).val();
					name = $($('.settings_')[2]).val();
					$.post('?module=configuration&ajax=1',{sabe:1, base_url:base_url, time_zone:time_zone, name:name});
					$('.settings[type=button]').attr('disabled', true);
				}
			});
		});
		</script>